package com.vsd.repository;


import java.util.Collection;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RestResource;

import com.shopcart.domain.StoreCategory;

@RestResource(exported = false)
public interface StoreCategoryRepository extends CrudRepository<StoreCategory, String> {

	Collection<StoreCategory> findByLevel(Integer level,Sort sort);
	
	Page<StoreCategory>  findAll(Pageable p);
	
	@Query("select count(1) from StoreCategory s where s.code = ?1")
	int countByCode(String code);
	
	Collection<StoreCategory> findByCode(String code);
}
